#include <iostream>
#include <vector>
using namespace std;


bool if_post_traverse(vector<int> & v, int start, int end)
{
	if (start == end)
		return true;

	int root = v[end];	//the root of tree
	int rleft = 0;		//the root of left sub tree
	int rright = 0;		//the root of right sub tree

	for (rleft = start; v[rleft] < root; rleft++)
		;
	
	for (rright = rleft; v[rright] > root; rright++)
		;

	if (rright != end)
		return false;

	if (--rleft > start - 1) {		//there is left sub tree rooted at rleft
		bool vl = if_post_traverse(v, start, rleft);
		if (!vl)
			return false;
	}

	if (--rright > rleft) {		//there is right sub tree rooted at rright
		bool vr = if_post_traverse(v, rleft + 1, rright);
		if (!vr)
			return false;
	}

	return true;
}

int main()
{
	vector<int> array;
	int n;
	while(cin>>n) {
		array.push_back(n);
	}

	bool result = if_post_traverse(array, 0, array.size() - 1);
	
	if (result)
		printf("this array can be a post-traverse of an binary search tree.\n");
	else
		printf("this array cannot be a post-traverse of an binary search tree.\n");
	
	return 0;
}
